package com.zut.service.impl;

import com.zut.dao.FoodDao;
import com.zut.dao.impl.FoodDaoImpl;
import com.zut.pojo.Employee;
import com.zut.pojo.Food;
import com.zut.pojo.PageInfo;
import com.zut.service.FoodService;

import java.sql.SQLException;
import java.util.List;

/**
 * @author 张晨
 * @date 2024/9/19 22:23
 * @desc
 */
public class FoodServiceImpl implements FoodService {
    private FoodDao foodDao = new FoodDaoImpl();
    @Override
    public PageInfo selectCond(Food food, Integer currentPage, Integer pageSize) {
        List<Food> list = null;
        Long total = 0L;
        try {
            list = foodDao.selectByfoodNameAndStatus(food, currentPage,pageSize);
            total = foodDao.countByfoodNameAndStatus(food);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

        PageInfo<Food> pageInfo = new PageInfo<>();
        pageInfo.setList(list);
        pageInfo.setTotal(total);
        return pageInfo;
    }
}
